package TestList;

import java.util.ArrayList;
import java.util.List;


/**
 * Created with IntelliJ IDEA.
 * Description:
 * list存储对象练习
 * User: 86184
 * Date: 2023-10-10
 * Time: 10:48
 */
public class TestList1 {
    public static void main(String[] args) {
        List<Student> stu = new ArrayList<>();

        Student st1 = new Student("霍浩然", 38,89.0,"天津");
        Student st2 = new Student("张萌", 58,59.0,"东北");
        Student st3 = new Student("张三", 68,99.0,"北京");
        stu.add(st1);
        stu.add(st2);
        stu.add(st3);

        stu.add(new Student("文博", 18, 100.0,"甘肃"));
        for(Student s: stu){
            System.out.println(s);
        }

        System.out.println("________________________");
        for(Student s : stu){
            if(s.getScore() > 90){
                System.out.println(s);
            }
        }

        System.out.println("_________________________-");
        //agv
        double sum = 0;
        for(Student s : stu){
            sum += s.getScore();
        }
        System.out.println("agv : "+sum / stu.size());

        System.out.println("____________________________");
        //天津
        for (Student s: stu){
            if(s.getAddress().equals("天津")){
                System.out.println(s);
            }
        }
    }
}
